package com.whmnx.my.ui.fragment;

/**
 * author : huang
 * date   : 2020/9/14 0014 11:32
 * version: 1.0
 */

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.Nullable;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.whmnx.base.constants.Constants;
import com.whmnx.base.router.RouterFragmentPath;
import com.whmnx.base.utils.ImageUtil;
import com.whmnx.my.BR;
import com.whmnx.my.R;
import com.whmnx.my.databinding.FragmentMeBinding;
import com.whmnx.my.ui.viewmodel.MeViewModel;

import me.goldze.mvvmhabit.base.BaseFragment;
import me.goldze.mvvmhabit.utils.SPUtils;

/**
 * Created by goldze on 2018/6/21
 * @author Administrator
 */
@Route(path = RouterFragmentPath.User.PAGER_ME)
public class MyFragment extends BaseFragment<FragmentMeBinding, MeViewModel> {
    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.fragment_me;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        super.initData();
       // initView();
        viewModel.initToolbar(this,binding);
        ImageUtil.setImage(binding.rvUser,SPUtils.getInstance().getString(Constants.HEAD_IMG));
    }

    @Override
    public void onHiddenChanged(boolean hidden) {
        super.onHiddenChanged(hidden);
       // ToastUtil.toastShortMessage(hidden + "");
        if (!hidden) viewModel.getUserInfo();
    }
}